//定义请求接口的api方法 (接口类型(参数类型|响应数据类型 data的类型) || 定义的请求方式 || 对外导出)
import http from "@/utils/http/index";

interface CaptchaType {
    image : string ,
    key : string
}

let getCaptcha = () =>{
    return http.get<CaptchaType>("/admin/login/captcha")
}


interface LoginType {
    username : string ,
    password : string ,
    captchaCode : string ,
    captchaKey : string
}

let login = (LoginForm:LoginType) =>{
    return http.post<string>("/admin/login",LoginForm)
}

interface UserInfoType {
    name : string ,
    avatarUrl : string
}

let getUserInfo = ()=>{
    return http.get<UserInfoType>("/admin/info")
}
export {
    getCaptcha,
    type CaptchaType,
    type LoginType,
    login,
    type UserInfoType,
    getUserInfo
}
